package 多线程.复习.线程方法;

public class ThreadInterruptrd {
    private static  class MyThread implements Runnable{
        boolean isRupt = false;
        @Override
        public void run() {
            while (!isRupt){
                System.out.println("正在通话中。。。。。");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("抢线了，糟糕，电话挂掉了");
        }
    }

    public static void main(String[] args) throws InterruptedException {
        MyThread t1 = new MyThread();
        Thread thread = new Thread(t1,"子线程");
        thread.start();
        System.out.println("主线程信号良好。。。");
        Thread.sleep(2000);
        t1.isRupt = true;
        System.out.println("主线程信号太差了。。。");
    }
}
